<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Shoppingerror extends Backend {

	public function __construct()
	{
		parent::__construct();
		$this->lang->load('sites');
		$this->load->model(['site_model','sitecategory_model','siteproduct_model','siteuser_model','siteorder_model','sitedisapproved_model']);
		$this->data['page_home']  = lang('lang_dashboard');
		$this->data['page_title'] = '广告错误';
		$this->data['sitetype'] = $this->config->item('site_types');
        $this->data['codetype'] = 
		[
			"policy_violation"=>"违反政策",
			"item_missing_required_attribute"=>"缺少必须属性",
			"image_link_broken"=>"图片无法打开"
		];
		
	}


	

	public function index()
	{

		// Title
		$this->data['meta_title'] = $this->data['page_title'];

		// Breadcrumbs
		$this->data['array_breadcrumbs'] = array(
			$this->data['page_home']  => 'backend',
			'全部网站用户'=>'backend/sites/product'
		);

		$key=trim($this->input->get('keyword'));
        $page=max(1,(int) $this->input->get('page'));   
        $code=trim($this->input->get('code'));     
        $pagesize=intval($this->input->get('pagesize'));
        if($pagesize){
            set_cookie("pagesize",$pagesize,60*60*24);
        }else{
            $pagesize=get_cookie("pagesize");
		}
		$this->data['sindex']=$this->site_model->get_name_index();		
		$page_data=$this->sitedisapproved_model->getpage(0,$page,$pagesize,$key,"",$code);
		$this->data['loglist']=$page_data["data"];
		$this->data['pager']=$page_data["pager"]; 
		$this->data['total']=$page_data["total"];
        $this->data['pages']=$page_data["pages"];
		$this->data['page']=$page;   
           
        
        $codelist  = $this->sitedisapproved_model->getcodes(0);
		$this->data["codelist"]=$codelist;
        $this->data["code"]=$code;
        
		$keyword = array(
			'name'      => 'keyword',
			'id'        => 'keyword',
			'value'     =>  $key,
			'class'     =>  'form-control input-sm',
			'placeholder'=> '请输入关键字',
			'maxlength' => '100'
		);
		$this->data['keyword']=$keyword;
		$this->data['content_header_title'] = content_header_title($this->data['page_title'],' 所有广告错误');
		$this->data['content'] = 'sites/alldisapproved';

		$this->render();

	}
}
